package com.azure.jvm;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/***
 * 1、finalize() test
 * 2、test oom
 * -Xms10M -Xmx10M -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=D:\jvm.dump
 */
public class OOMTest {

    public static void main(String[] args) {
        List<Object> list = new ArrayList<>();
        int i = 0;
        int j = 0;
        while (true){
            list.add(new User(i++, UUID.randomUUID().toString()));
            new User(j--,UUID.randomUUID().toString());// finalize 可以拯救
        }
    }
}
